﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DTO;
using DAO;

namespace QLDaiLy
{
    public partial class BaoCaoCongNo :XtraUserControl
    {
        public BaoCaoCongNo()
        {
            InitializeComponent();
            cbbThangBaoCao.SelectedIndex = -1;
            fillMonthCombobox();
        }
        private void loadBaoCaoCongNoTheoThang()
        {
            string thang = cbbThangBaoCao.EditValue.ToString();
            List<BaoCaoCongNoDTO> dt = BaoCaoCongNoDAO.baoCaoTheoThang(thang);
            gridControlBaoCaoDoanhSo.DataSource = dt;
        }
        private void fillMonthCombobox()
        {
            for (int i = 1; i <= 12; i++)
            {
                cbbThangBaoCao.Properties.Items.Add(i);
            }
            cbbThangBaoCao.SelectedIndex = -1;
        }

        private void cbbThangBaoCao_SelectedValueChanged(object sender, EventArgs e)
        {
            loadBaoCaoCongNoTheoThang();
        }

        private void btnBaoCaoCongNo_Click(object sender, EventArgs e)
        {
            FrmReportCongNo frm = new FrmReportCongNo();
            frm.ShowDialog();
            frm.Dispose();
        }
    }
}
